﻿using Basic.FormGatewaryModular.Interface;
using Basic.FormGatewaryModular.Model.UserForm;
using Basic.FormRemoteModel.UserForm;
using Basic.FormRemoteModel.UserForm.Model;
using WeDonekRpc.Modular;

namespace Basic.FormGatewaryModular.Services
{
    internal class UserFormService : IUserFormService
    {
        public CalculateColState[] CalculateState ( long formId, CalculateArg arg )
        {
            return new CalculateFormColState
            {
                Arg = arg,
                FormId = formId,
            }.Send();
        }
        public CalculateResult[] Calculate ( long formId, CalculateArg arg )
        {
            return new CalculateFormCol
            {
                Arg = arg,
                FormId = formId,
            }.Send();
        }
        public UserFormBody Get ( UserFormGet arg, IUserState state )
        {
            return new GetUserFormBody
            {
                Param = new FormGetArg
                {
                    CompanyId = state.ToCompanyId(),
                    EmpId = state.ToEmpId(),
                    Extend = arg.Extend,
                    FormId = arg.FormId,
                    LinkPk = arg.LinkPk,
                    LinkType = arg.LinkType,
                    FillValue = arg.FillValue
                }
            }.Send();
        }
    }
}
